public class StaticProxy {

    public static void main(String[] args) {

        // 线程加Lamda表达式
        new Thread( ()-> System.out.println("我爱你，我要结婚了。") ).start();

//        Role you=new Role();
//        MarryCompany weddingCompany=new MarryCompany(you);
//        weddingCompany.happyMarry();
        new MarryCompany(new Role()).happyMarry();
    }
}

interface Marry{
    void happyMarry();
}

class Role implements Marry{
    @Override
    public void happyMarry() {
        System.out.println("我要结婚了hhh。");
    }
}
class MarryCompany implements Marry{
    // 代理对象帮助的真实对象
    private Marry target;

    public MarryCompany(Marry target) {
        this.target = target;
    }

    @Override
    public void happyMarry() {
        before();
        this.target.happyMarry();  // 但还是真实对象去Marry
        after();
    }

    private void after() {
        System.out.println("结婚之后，打扫场地。");
    }

    private void before() {
        System.out.println("结婚之前，布置场地。");
    }
}